<template>
	<!-- pages/vip/vip.wxml -->
	<view>
		<!-- <view v-if="vipList.length"> -->
		<view style="position:relative;">
			<nav txtColor="#FFFFFF" image="../..https://oos-cn.ctyunapi.cn/front-end/static/back1.png" title="会员等级"
				:show_bol="false"></nav>
			<view class="header_bg"></view>
			<view :style="
          'padding-top:' +
          (widnowH <= 568 ? bar_Height + 50 : bar_Height + 55) +
          'rpx;'
        ">
				<view class="instructions" :style="
            'top:' +
            (widnowH <= 568 ? bar_Height + 50 : bar_Height + 55) +
            'rpx;'
          ">
					<!-- <text v-if="consumeMoney">消费{{ consumeMoney / 100 }}元获得{{
              equivalentIntegral
            }}消费积分</text> -->
					<!-- <image src="https://oos-cn.ctyunapi.cn/front-end/static/mine/images/instruction.png" class="instructions_img"></image> -->
				</view>
				<view class="swiper">
					<swiper previous-margin="33rpx" next-margin="33rpx" :circular="true" :current="current"
						@change="bindChange">
						<block v-for="(item, index) in memberRuleList" :key="index">
							<swiper-item id="swiperList" :item-id="item.curLevelId">
								<block>
									<image
										:src="'http://oos-cn.ctyunapi.cn/front-end/static/marketingImg/mine/images/vip_bg' +item.curLevelId+ '.png'">
									</image>
									<view class="vip_name">
										<image
											src="http://oos-cn.ctyunapi.cn/front-end/static/marketingImg/mine/images/vip_hg.png"
											class="vip_name_icon"></image>
										<view class="vip_type">{{ item.levelName }}</view>
										<view class="vip_grade" v-if="currentId&&currentId==item.curLevelId">当前等级</view>
									</view>
									<view class="vip-details" @click="toDesc(item)">权益介绍</view>

									<view class="swiper-item__bottom flex-row-between">
										<view class="bottom-left">
											<view style="font-size: 30rpx;">
												<text>{{ item.curPoints||0}}</text>/{{item.levelHighValue}}
											</view>
											<block>
												<view class="swiper-progress">
													<view class="swiper-progress__bg"
														:style="'width:' + item.progress + '%'"></view>
												</view>
												<view v-if="item.progress!=100">
													距离升级还需
													<text>{{ item.differenceIntegral }}积分</text>
												</view>
											</block>
										</view>

										<view class="bottom-right" v-if="item.progress==100">
											<view>已经达到最高</view>
											<view>等级</view>
										</view>
									</view>
								</block>
							</swiper-item>
						</block>
					</swiper>
				</view>
				<!-- 签到 -->
				<view class="qiandao">
					<view class="guide">
						<view>签到赢好礼</view>
						<view>
							<view :style="{ color: defaultColor }">签到提示</view>
							<u-switch size="40" v-model="qdvalue" @change="qdChange" :inactiveColor="'#ccc'"
								:activeColor="defaultColor"></u-switch>
						</view>
					</view>
					<view class="qdDateList">
						<view class="dateList">
							<view class="dateItem" v-for="(item,index) in signList" :key="index">
								<view v-if="item.signStatus==2">
									<u-icon name="checkbox-mark" color="#6DB12E" size="28"></u-icon>
								</view>
								<view v-if="item.signStatus==1&&index<6">+2</view>
								<view v-if="index==6&&item.signStatus==1">
									<image style="width: 36rpx;" mode="widthFix" :src="giftGreen_icon"></image>
								</view>
								<view>第{{index+1}}天</view>
							</view>
						</view>
						<view class="qdButton" v-if="!isQD" @click="appUserSignClicked(1)"
							:style="{ backgroundColor: defaultColor }">签到</view>
						<view class="qdButton" v-if="isQD" @click="appUserSignClicked(2)"
							style="background: #6DB12E;opacity: 0.6;">
							今日已签到</view>
					</view>
				</view>
				<!-- 日常任务 -->
				<view class="taskBox" v-if="dailyTaskLists&&dailyTaskLists.length != 0">
					<view class="title">日常任务</view>
					<view class="taskList">
						<view class="taskItem" v-for="(item,dailyIndex) in dailyTaskLists" :key="dailyIndex">
							<!-- 任务类型(1=-邀请好友,2=-充电,3=-车辆认证,4=-车主认证,5=-广告浏览,6=-充值,7=-登录,8=-签到,9=-注册) -->
							<view
								:style="{ backgroundImage: 'url('+ `${item.taskType==1?haoyou_icon:item.taskType==2?chongdian_icon:item.taskType==3?car_icon:item.taskType==4?chezhu_icon:item.taskType==5?guanggao_icon:chongzhirenwu_icon}` + ')' }">
								<view class="vip" v-if="item.taskObject == 2">VIP</view>
							</view>
							<view>
								<view>
									<view style="font-size: 26rpx;font-weight: 600;color: #303133;">{{ item.taskName }}
									</view>
									<view style="font-size: 24rpx;color: #FC724C;margin: 0 16rpx;"
										v-if="item.rewardPoints">+{{item.rewardPoints}}积分</view>
									<view v-if="item.rewardSettingEquity == 1"
										style="width: 45rpx;height:45rpx;background-color: rgba(252, 114, 76, 0.1);border-radius: 50%;display: flex;flex-direction: row;justify-content: center;align-items: center;">
										<image style="width:25rpx;height:28rpx;" :src="giftPink_icon"></image>
									</view>
								</view>
								<view v-if="item.taskType == 1 && item.behaviorCondition == 1">
									邀请{{item.inviteFriendNum}}名好友成功注册并充电{{ item.rewardPoints }}度以上</view>
								<view v-if="item.taskType == 1 && item.behaviorCondition == 2">
									邀请{{item.inviteFriendNum}}名好友成功注册并充电次数累计{{ item.limitedChargingTimes }}次以上</view>
								<view v-if="item.taskType == 2">单笔充电{{ item.rewardPoints }}度以上</view>
								<view v-if="item.taskType == 3">完成车辆认证</view>
								<view v-if="item.taskType == 4">完成车主认证</view>
								<view v-if="item.taskType == 5">浏览{{item.adViews}}次广告</view>
								<view v-if="item.taskType == 6 && item.rechargeChecksum == 1">
									单笔充值{{item.rechargeAmount}}元以上</view>
								<view v-if="item.taskType == 6 && item.rechargeChecksum == 2">
									累计充值{{item.rechargeAmount}}元以上</view>
								<!-- <view v-if="item.limitedChargingTimes">{{ item.limitedChargingTimes }}</view> -->
							</view>
							<view>
								<view @click="goAction(item)" v-if="!item.marketTaskRewardRecords"
									:style="{ border:`1rpx solid ${defaultColor}`,color:`${defaultColor}`,backgroundColor:`${defaultColor == '#6DB12E'?'rgba(120, 199, 68, 0.08)':'rgba(20, 135, 250, 0.08)'}`}">
									<text v-if="item.taskType == 1">去邀请</text>
									<text v-if="item.taskType == 2">去充电</text>
									<text v-if="item.taskType == 3">去认证</text>
									<text v-if="item.taskType == 4">去认证</text>
									<text v-if="item.taskType == 5">去浏览</text>
									<text v-if="item.taskType == 6">去充值</text>
								</view>
								<view @click="getAward(item)" v-if="item.marketTaskRewardRecords&&item.marketTaskRewardRecords.completionStatus==2" :style="{backgroundColor:`${defaultColor}`,color:'#FFFFFF',border:'none'}">
									<text>领取奖励</text>
								</view>
								<view v-if="item.marketTaskRewardRecords&&item.marketTaskRewardRecords.completionStatus==1" :style="{backgroundColor:'#DCDFE6',color:'#909399',border:'none'}">
									<text>已完成</text>
								</view>
								<view v-if="item.name6&&item.name7">已完成：<text
										style="color: #FC724C;">{{ item.name6 }}</text>/{{ item.name7 }}</view>
							</view>
						</view>
					</view>
				</view>
				<!-- 专属任务 -->
				<view class="taskBox" v-if="exclusiveTaskLists&&exclusiveTaskLists.length != 0">
					<view class="title">专属任务</view>
					<view class="taskList">
						<view class="taskItem" v-for="(item,exclusiveIndex) in exclusiveTaskLists"
							:key="exclusiveIndex">
							<!-- 任务类型(1=-邀请好友,2=-充电,3=-车辆认证,4=-车主认证,5=-广告浏览,6=-充值,7=-登录,8=-签到,9=-注册) -->
							<view
								:style="{ backgroundImage: 'url('+ `${item.taskType==1?haoyou_icon:item.taskType==2?chongdian_icon:item.taskType==3?car_icon:item.taskType==4?chezhu_icon:item.taskType==5?guanggao_icon:chongzhirenwu_icon}` + ')' }">
								<view class="vip" v-if="item.taskObject == 2">VIP</view>
							</view>
							<view>
								<view>
									<view style="font-size: 26rpx;font-weight: 600;color: #303133;">{{ item.taskName }}
									</view>
									<view style="font-size: 24rpx;color: #FC724C;margin: 0 16rpx;"
										v-if="item.rewardPoints">+{{item.rewardPoints}}积分</view>
									<view v-if="item.rewardSettingEquity == 1"
										style="width: 45rpx;height:45rpx;background-color: rgba(252, 114, 76, 0.1);border-radius: 50%;display: flex;flex-direction: row;justify-content: center;align-items: center;">
										<image style="width:25rpx;height:28rpx;" :src="giftPink_icon"></image>
									</view>
								</view>
								<view v-if="item.taskType == 1 && item.behaviorCondition == 1">
									邀请{{item.inviteFriendNum}}名好友成功注册并充电{{ item.rewardPoints }}度以上</view>
								<view v-if="item.taskType == 1 && item.behaviorCondition == 2">
									邀请{{item.inviteFriendNum}}名好友成功注册并充电次数累计{{ item.limitedChargingTimes }}次以上</view>
								<view v-if="item.taskType == 2">单笔充电{{ item.rewardPoints }}度以上</view>
								<view v-if="item.taskType == 3">完成车辆认证</view>
								<view v-if="item.taskType == 4">完成车主认证</view>
								<view v-if="item.taskType == 5">浏览{{item.adViews}}次广告</view>
								<view v-if="item.taskType == 6 && item.rechargeChecksum == 1">
									单笔充值{{item.rechargeAmount}}元以上</view>
								<view v-if="item.taskType == 6 && item.rechargeChecksum == 2">
									累计充值{{item.rechargeAmount}}元以上</view>
								<!-- <view v-if="item.limitedChargingTimes">{{ item.limitedChargingTimes }}</view> -->
							</view>
							<view>
								<view @click="goAction(item)" v-if="!item.marketTaskRewardRecords"
									:style="{ border:`1rpx solid ${defaultColor}`,color:`${defaultColor}`,backgroundColor:`${defaultColor == '#6DB12E'?'rgba(120, 199, 68, 0.08)':'rgba(20, 135, 250, 0.08)'}`}">
									<text v-if="item.taskType == 1">去邀请</text>
									<text v-if="item.taskType == 2">去充电</text>
									<text v-if="item.taskType == 3">去认证</text>
									<text v-if="item.taskType == 4">去认证</text>
									<text v-if="item.taskType == 5">去浏览</text>
									<text v-if="item.taskType == 6">去充值</text>
								</view>
								<view @click="getAward(item)" v-if="item.marketTaskRewardRecords&&item.marketTaskRewardRecords.completionStatus==2" :style="{backgroundColor:`${defaultColor}`,color:'#FFFFFF',border:'none'}">
									<text>领取奖励</text>
								</view>
								<view v-if="item.marketTaskRewardRecords&&item.marketTaskRewardRecords.completionStatus==1" :style="{backgroundColor:'#DCDFE6',color:'#909399',border:'none'}">
									<text>已完成</text>
								</view>
								<view v-if="item.name6&&item.name7">已完成：<text
										style="color: #FC724C;">{{ item.name6 }}</text>/{{ item.name7 }}</view>
							</view>
						</view>
					</view>
				</view>
				<!-- 限时任务 -->
				<view class="taskBox" v-if="timeTaskLists&&timeTaskLists.length != 0">
					<view class="title">限时任务</view>
					<view class="taskList">
						<view class="taskItem" v-for="(item,timeIndex) in timeTaskLists" :key="timeIndex">
							<!-- 任务类型(1=-邀请好友,2=-充电,3=-车辆认证,4=-车主认证,5=-广告浏览,6=-充值,7=-登录,8=-签到,9=-注册) -->
							<view
								:style="{ backgroundImage: 'url('+ `${item.taskType==1?haoyou_icon:item.taskType==2?chongdian_icon:item.taskType==3?car_icon:item.taskType==4?chezhu_icon:item.taskType==5?guanggao_icon:chongzhirenwu_icon}` + ')' }">
								<view class="vip" v-if="item.taskObject == 2">VIP</view>
							</view>
							<view>
								<view>
									<view style="font-size: 26rpx;font-weight: 600;color: #303133;">{{ item.taskName }}
									</view>
									<view style="font-size: 24rpx;color: #FC724C;margin: 0 16rpx;"
										v-if="item.rewardPoints">+{{item.rewardPoints}}积分</view>
									<view v-if="item.rewardSettingEquity == 1"
										style="width: 45rpx;height:45rpx;background-color: rgba(252, 114, 76, 0.1);border-radius: 50%;display: flex;flex-direction: row;justify-content: center;align-items: center;">
										<image style="width:25rpx;height:28rpx;" :src="giftPink_icon"></image>
									</view>
								</view>
								<view v-if="item.taskType == 1 && item.behaviorCondition == 1">
									邀请{{item.inviteFriendNum}}名好友成功注册并充电{{ item.rewardPoints }}度以上</view>
								<view v-if="item.taskType == 1 && item.behaviorCondition == 2">
									邀请{{item.inviteFriendNum}}名好友成功注册并充电次数累计{{ item.limitedChargingTimes }}次以上</view>
								<view v-if="item.taskType == 2">单笔充电{{ item.rewardPoints }}度以上</view>
								<view v-if="item.taskType == 3">完成车辆认证</view>
								<view v-if="item.taskType == 4">完成车主认证</view>
								<view v-if="item.taskType == 5">浏览{{item.adViews}}次广告</view>
								<view v-if="item.taskType == 6 && item.rechargeChecksum == 1">
									单笔充值{{item.rechargeAmount}}元以上</view>
								<view v-if="item.taskType == 6 && item.rechargeChecksum == 2">
									累计充值{{item.rechargeAmount}}元以上</view>
								<!-- <view v-if="item.limitedChargingTimes">{{ item.limitedChargingTimes }}</view> -->
							</view>
							<view>
								<view @click="goAction(item)" v-if="!item.marketTaskRewardRecords"
									:style="{ border:`1rpx solid ${defaultColor}`,color:`${defaultColor}`,backgroundColor:`${defaultColor == '#6DB12E'?'rgba(120, 199, 68, 0.08)':'rgba(20, 135, 250, 0.08)'}`}">
									<text v-if="item.taskType == 1">去邀请</text>
									<text v-if="item.taskType == 2">去充电</text>
									<text v-if="item.taskType == 3">去认证</text>
									<text v-if="item.taskType == 4">去认证</text>
									<text v-if="item.taskType == 5">去浏览</text>
									<text v-if="item.taskType == 6">去充值</text>
									<text v-if="item.taskType == 7">去登录</text>
									<text v-if="item.taskType == 8">去签到</text>
									<text v-if="item.taskType == 9">去注册</text>
								</view>
								<view @click="getAward(item)" v-if="item.marketTaskRewardRecords&&item.marketTaskRewardRecords.completionStatus==2" :style="{backgroundColor:`${defaultColor}`,color:'#FFFFFF',border:'none'}">
									<text>领取奖励</text>
								</view>
								<view v-if="item.marketTaskRewardRecords&&item.marketTaskRewardRecords.completionStatus==1" :style="{backgroundColor:'#DCDFE6',color:'#909399',border:'none'}">
									<text>已完成</text>
								</view>
								<view v-if="item.name6&&item.name7">已完成：<text
										style="color: #FC724C;">{{ item.name6 }}</text>/{{ item.name7 }}</view>
							</view>
						</view>
					</view>
				</view>

				<view style="width: 100%;height:100rpx"></view>
				<view></view>
				<!-- 最终解释权归平台所有 -->
				<!-- <view class="copy_right">
                <text>最终解释权归平台所有</text>
            </view> -->
			</view>
		</view>
		<!-- <view v-else> -->
		<!-- <view>
        <nav txtColor="#18181A" image="../..https://oos-cn.ctyunapi.cn/front-end/static/back.png" title="会员等级" :show_bol="false"></nav>
        <Upgrading text="暂无内容"></Upgrading>
    </view> -->
		<u-modal :show="showqd" title="恭喜签到成功" confirmText="我知道了" :confirmColor="defaultColor" @confirm="QDConfirm">
			<scroll-view class="slot-content giftsList" scroll-x="true" v-if="qiandaolist.length!=0">
				<view class="qdGift" v-for="(item,index) in qiandaolist" :key="index">
					<view v-if="item.type == 'card'" :style="{ backgroundImage: 'url('+ icon_kabao + ')' }"></view>
					<view v-if="item.type == 'coupon'" :style="{ backgroundImage: 'url('+ icon_youhuiquan + ')' }">
					</view>
					<view v-if="item.type == 'points'" :style="{ backgroundImage: 'url('+ icon_jifen + ')' }"></view>
					<view v-if="item.type == 'growth'" :style="{ backgroundImage: 'url('+ icon_chengzhangjiasu + ')' }">
					</view>
					<view v-if="item.type == 'equity'" :style="{ backgroundImage: 'url('+ chongzhirenwu_icon + ')' }">
					</view>
					<view v-if="item.type == 'bounds'" :style="{ backgroundImage: 'url('+ icon_jianglijin + ')' }">
					</view>
					<view>{{ item.key }}</view>
					<view class="tips">{{item.value}}</view>
				</view>
			</scroll-view>
		</u-modal>
		<u-modal :show="showts" title="温馨提示" confirmText="开通VIP" :confirmColor="defaultColor" @confirm="openConfirm">
			<view class="slot-content">
				该任务是VIP会员特享任务，您还不是VIP，马上去升级吧
			</view>
		</u-modal>
		<u-modal :show="showqd1" title="今日已签到!" confirmText="我知道了" :confirmColor="defaultColor" @confirm="resetConfirm">
		</u-modal>
	</view>
</template>

<script>
	"use strict";
	import nav from "../../../components/nav/nav";
	import Upgrading from "../../../components/upgrading/upgrading";

	// exports.__esModule = true;

	var https_1 = require("@/api/https.js");
	import {
		getDailyTasksList,
		getExclusiveTasksList,
		getTimedTasksList,
		getGrowthCenterInfoList,
		appUserSignInRecord,
		userSignin,
		menberBuylist,
		noVipDetail,
		getAward
	} from '@/api/marketing/vip'
	const app = getApp();
	export default {
		components: {
			nav,
			Upgrading,
		},
		data() {
			return {
				isQD: false,
				showts: false,
				showqd: false,
				showqd1: false,
				qdvalue: true,
				defaultColor: uni.getStorageSync("defaultColor_Green"),
				giftBlue_icon: `${app.globalData.imgUrl}/group1/operateSchemeImage/image/giftblue.svg`,
				// giftGreen_icon: `${app.globalData.imgUrl}/group1/operateSchemeImage/image/giftgreen.svg`,
				giftGreen_icon: '',
				// giftPink_icon: `${app.globalData.imgUrl}/group1/operateSchemeImage/image/gift.svg`,
				giftPink_icon: '',
				chongzhi_icon: `${app.globalData.imgUrl}/group1/operateSchemeImage/image/icon/icon_chongzhi.png`,
				car_icon: `${app.globalData.imgUrl}/group1/operateSchemeImage/image/icon/icon_car.png`,
				chezhu_icon: `${app.globalData.imgUrl}/group1/operateSchemeImage/image/icon/icon_chezhu.png`,
				chongdian_icon: `${app.globalData.imgUrl}/group1/operateSchemeImage/image/icon/icon_chongdian.png`,
				chongzhirenwu_icon: `${app.globalData.imgUrl}/group1/operateSchemeImage/image/icon/icon_chongzhirenwu.png`,
				guanggao_icon: `${app.globalData.imgUrl}/group1/operateSchemeImage/image/icon/icon_guanggao.png`,
				haoyou_icon: `${app.globalData.imgUrl}/group1/operateSchemeImage/image/icon/icon_haoyou.png`,
				vip_icon: `${app.globalData.imgUrl}/group1/operateSchemeImage/image/icon/icon-vip.png`,

				icon_kabao: `${app.globalData.imgUrl}/group1/operateSchemeImage/image/quanyi/icon_kabao.png`,
				icon_jifen: `${app.globalData.imgUrl}/group1/operateSchemeImage/image/quanyi/icon_jifen.png`,
				icon_chengzhangjiasu: `${app.globalData.imgUrl}/group1/operateSchemeImage/image/quanyi/icon_chengzhangjiasu.png`,
				icon_youhuiquan: `${app.globalData.imgUrl}/group1/operateSchemeImage/image/quanyi/icon_youhuiquan.png`,
				icon_jianglijin: `${app.globalData.imgUrl}/group1/operateSchemeImage/image/quanyi/icon_jianglijin.png`,

				hasvipList: [],
				vipList: [],
				current: 0,
				equivalentIntegral: null,
				consumeMoney: null,
				widnowH: 0,
				bar_Height: 0,

				servicePackage: {
					rate: "",
					reward: "",
					freeCount: "",
				},
				taskList: [],
				exclusiveTaskLists: [], //专属任务
				dailyTaskLists: [], //日常任务
				timeTaskLists: [], //限时任务
				signRecordList: [],
				signList: [{
						signStatus: 1,
					},
					{
						signStatus: 1,
					},
					{
						signStatus: 1,
					},
					{
						signStatus: 1,
					},
					{
						signStatus: 1,
					},
					{
						signStatus: 1,
					},
					{
						signStatus: 1,
					}
				],
				qiandaolist: [],

				// 会员列表
				memberRuleList: [],
				currentId: null,

			};
		},
		/**
		 * 生命周期函数--监听页面加载
		 */
		created() {

		},
		onLoad() {
			this.getMemberRuleList()
			this.getMenberBuylist();
			this.appUserSignList();
			this.getExclusiveTaskList();
			this.getDailyTaskLists();
			this.getTimedTaskList();
			this.bar_Height = parseInt(uni.getSystemInfoSync().statusBarHeight); //获得手机状态栏高度
			this.memberGradeRule();
			this.getVipList()
		},
		methods: {
			//领取奖励
			getAward(row){
				let taskId=row.id
				uni.showModal({
					content: '确认领取奖励吗？',
					success: function(res) {
						if (res.confirm) {
							getAward(taskId).then(res=>{
								if(res.code==200){
									this.getExclusiveTaskList();
									this.getDailyTaskLists();
									this.getTimedTaskList();
									uni.showToast({
										title: '领取成功',
										icon: 'none',
										duration: 2000
									})
								}
							})
						}
					}
				});
			},
			goAction(row) { //任务操作
				//任务类型(1=-邀请好友,2=-充电,3=-车辆认证,4=-车主认证,5=-广告浏览,6=-充值,7=-登录,8=-签到,9=-注册)
				let type = row.taskType
				console.log(type)
				let needVip = row.taskObject
				if (needVip == 2 && this.vipList.length == 0) {
					this.showts = true
					return
				}
				//根据任务类型执行不同操作
				switch (type) {
					case 1:
						break;
					case 2:
						break;
					case 3://车辆认证
					uni.navigateTo({
						url: "/mine/pages/authentication/index"
					})
						break;
					case 4://车主认证
					// uni.navigateTo({
					// 	url: "/mine/pages/authentication/index"
					// })
						break;
					case 5:
						break;
					case 6://充值
						uni.navigateTo({
							url: "/mine/pages/recharge/recharge"
						})
						break;
					case 7:
						break;
					case 8:
						break;
					case 9:
						break;
				}
			},
			openConfirm() { //开通VIP
				this.showts = false
				let vipId = this.vipList[0].vipId
				uni.navigateTo({
					url: "/mine/pages/vip/noVip?id=" + vipId,
				})
			},
			getVipList() { //会员列表
				noVipDetail().then(res => {
					if (res.code == 200) {
						this.vipList = res.data
					}
				})
			},
			resetConfirm() { //关闭已签到弹窗
				this.showqd1 = false
			},
			getMenberBuylist() { //已购会员列表
				menberBuylist().then(res => {
					this.hasvipList = res.data.records
				})
			},
			appUserSignList() { //签到列表
				appUserSignInRecord().then(res => {
					if (res.code == 200) {
						this.signRecordList = res.data || [];
						let num = this.signRecordList.length
						if (num == 0) {
							return
						}
						console.log(uni.$u.timeFormat(null, 'yyyy-mm-dd'))
						console.log(this.signRecordList[num - 1].signInDate)
						let nowDate = uni.$u.timeFormat(null, 'yyyy-mm-dd')
						let date = this.signRecordList[num - 1].signInDate
						if (nowDate == date) {
							this.isQD = true
						} else {
							this.isQD = false
						}
						this.signList = this.signList.slice(num)
						this.signList = this.signRecordList.concat(this.signList)
						this.$set(this.signList)
					}
				})
			},
			appUserSignClicked(index) { //1：未签到 2：已签到
				if (index == 2) {
					this.showqd1 = true
				} else {
					console.log('签到时间', uni.$u.timeFormat(null, 'yyyy-mm-dd'))
					userSignin({
						signInDate: uni.$u.timeFormat(null, 'yyyy-mm-dd')
					}).then(res => {
						if (res.code == 200) {
							this.qiandaolist = res.data.slice(1) || [];
							this.showqd = true;
							this.appUserSignList();
						}
					})
				}
			},
			getMemberRuleList() {
				getGrowthCenterInfoList().then((res) => {
					let list=""
					if (res.data.curLevelId) {
						let obj = {
							curLevelId: res.data.curLevelId,
							curPoints: res.data.curPoints,
							id: res.data.id,
							levelHighValue: res.data.levelHighValue,
							levelLowValue: res.data.levelLowValue,
							levelName: res.data.levelName
						}
						let lastArr = res.data.marketGrowthleRulePrevVoList
						lastArr.push(obj)
						list = lastArr.concat(res.data.marketGrowthleRuleNextVoList)
					}else{
						list=res.data.marketGrowthleRuleNextVoList
					}
					// 设置当前等级的那个卡片
					let current = 0
					list.forEach((item, index) => {
						if (item.curLevelId == res.data.curLevelId) {
							current = index
							this.currentId = item.curLevelId
						}
						if(index<current){
							item.curPoints=item.levelHighValue
						}
						if(index>current){
							item.curPoints=0
						}
						//   设置进度条展示
						item.progress = ((item.curPoints || 0) / item.levelHighValue) *
							100;
						if (item.progress >= 100) {
							item.progress = 100;
						}
						// 获取等级积分区间的最大值加1，得到下一等级要求
						item.nextLevelLowValue = item.levelHighValue + 1;
						// 设置距离下一个等级还差多少积分
						// 初始化值
						item.differenceIntegral = 0;
						item.differenceIntegral = item.nextLevelLowValue - (item.curPoints || 0);
						if (item.differenceIntegral < 0) {
							item.differenceIntegral = 0;
						}
					});
					this.setData({
						memberRuleList: list,
						current: current
					});
					console.log(this.memberRuleList, '会员列表');
					console.log(this.current, '当前等级')
				});
			},
			getExclusiveTaskList() { //专属任务列表
				getExclusiveTasksList({
					releaseType: 1
				}).then(res => {
					if (res.code == 200) {
						this.exclusiveTaskLists = res.data || [];
					}
				})
			},
			getDailyTaskLists() { //日常任务列表
				getDailyTasksList({
					releaseType: 2
				}).then(res => {
					if (res.code == 200) {
						this.dailyTaskLists = res.data || [];
					}
				})
			},
			getTimedTaskList() { //限时任务列表
				getTimedTasksList({
					releaseType: 3
				}).then(res => {
					if (res.code == 200) {
						this.timeTaskLists = res.data || [];
					}
				})
			},
			toDesc(row) { //权益介绍
				console.log(row)
				let status = 1
				if (this.currentId && this.currentId == row.curLevelId) {
					status = 2
				}
				// return
				uni.navigateTo({
					url: `./vipDesc?id=${row.id}&status=${status}`
				});
			},
			QDConfirm() { //关闭签到成功弹窗
				this.showqd = false;
			},
			qdChange(val) { //签到提示按钮变动
				console.log(val);
			},

			bindChange(e) {
				console.log(e)
				var current = e.detail.current;
				this.setData({
					current: current,
				});
			},

			memberGradeRule: function() {
				var that = this;
				https_1
					.getMemberGradeRule({})
					.then(function(res) {
						if (res.code == 0) {
							if (res.data.integralConfig) {
								that.setData({
									consumeMoney: res.data.integralConfig.consumeMoney,
									equivalentIntegral: res.data.integralConfig.equivalentIntegral,
								});
							}
						}
					})["catch"](function(err) {
						console.log(err);
					});
			},
		},
	};
</script>

<style lang="less">
	@import url("./vip.less");

	.qiandao {
		width: 94%;
		margin: 0rpx auto;
	}

	.guide {
		width: 100%;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;

		>view:nth-of-type(1) {
			width: 170rpx;
			height: 34rpx;
			font-size: 34rpx;
			font-weight: 400;
			color: #18181A;
			line-height: 34rpx;
			padding-left: 32rpx;
		}

		>view:nth-of-type(2) {
			display: flex;
			flex-direction: row;
			justify-content: flex-start;
			align-items: center;
			font-size: 28rpx;
			font-weight: 400;

			>view:nth-of-type(1) {
				margin-right: 15rpx;
			}
		}
	}

	.qdDateList {
		width: 100%;
		height: 312rpx;
		margin-top: 32rpx;
		background: linear-gradient(360deg,
				#ffffff 0%,
				#ffffff 31%,
				#f4f6f8 99%,
				#f4f6f8 100%);
		box-shadow: 4rpx 7rpx 20rpx 0rpx rgba(166, 171, 178, 0.2392);
		border-radius: 16rpx;
		border: 2rpx solid #ffffff;
		overflow: hidden;
		padding: 40rpx 32rpx;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		align-items: flex-start;
	}

	.dateList {
		width: 100%;
		display: flex;
		flex-wrap: nowrap;
		flex-direction: row;
		justify-content: flex-start;
		align-items: center;

		.dateItem {
			display: flex;
			flex-direction: column;
			justify-content: flex-start;
			align-items: center;
			margin: 0 16rpx;

			>view:nth-of-type(1) {
				width: 64rpx;
				height: 64rpx;
				background: rgba(120, 199, 68, 0.16);
				opacity: 1;
				text-align: center;
				line-height: 64rpx;
				font-size: 28rpx;
				font-weight: 400;
				color: #6DB12E;
				border-radius: 50%;
				display: flex;
				flex-direction: row;
				justify-content: center;
				align-items: center;
			}

			>view:nth-of-type(2) {
				margin-top: 16rpx;
				font-size: 22rpx;
				font-weight: 400;
				color: #606266;
			}
		}
	}

	.qdButton {
		width: 100%;
		height: 68rpx;
		line-height: 68rpx;
		text-align: center;
		margin: 0 auto;
		font-size: 30rpx;
		font-weight: 400;
		color: #ffffff;
		border-radius: 44rpx;
	}

	.taskBox {
		width: 94%;
		margin: 40rpx auto 0 auto;

		.title {
			width: 100%;
			padding: 0 32rpx;
			box-sizing: border-box;
		}
	}

	.taskList {
		width: 100%;
		margin-top: 30rpx;
		background: linear-gradient(360deg, #FFFFFF 0%, #FFFFFF 31%, #F4F6F8 99%, #F4F6F8 100%);
		box-shadow: 4rpx 7rpx 20rpx 0rpx rgba(166, 171, 178, 0.2392);
		border-radius: 16rpx;
		opacity: 1;
		border: 2rpx solid #FFFFFF;
		padding: 0rpx 32rpx;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		align-items: flex-start;

		>view:nth-of-type(1) {
			border-top: none !important;
		}
	}

	.taskItem {
		width: 100%;
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		align-items: center;
		padding: 40rpx 0;
		box-sizing: border-box;
		border-top: 1rpx dashed #C0C4CC;

		>view:nth-of-type(1) {
			width: 72rpx;
			height: 72rpx;
			border-radius: 50%;
			position: relative;
			background-size: 100% 100%;
			background-repeat: no-repeat;
			background-position: center;

			.vip {
				width: 52rpx;
				height: 32rpx;
				background: linear-gradient(357deg, #E4B97A 0%, #FFE6BA 100%);
				border-radius: 16rpx 16rpx 16rpx 0rpx;
				position: absolute;
				top: -10rpx;
				right: -20rpx;
				font-size: 22rpx;
				color: #705328;
				text-align: center;
				line-height: 32rpx;
			}
		}

		>view:nth-of-type(2) {
			width: 60%;
			display: flex;
			flex-direction: column;
			justify-content: flex-start;
			align-items: flex-start;
			margin-left: 16rpx;
			// padding-right: 40rpx;
			box-sizing: border-box;

			// 充值有礼
			>view:nth-of-type(1) {
				color: #303133;
				display: flex;
				flex-direction: row;
				justify-content: flex-start;
				align-items: center;

				>view:nth-of-type(1) {
					font-size: 30rpx;
					color: #303133;
				}

				>view:nth-of-type(2) {
					font-size: 28rpx;
					color: #FC724C;
				}

				>view:nth-of-type(3) {}
			}

			>view:nth-of-type(2) {
				font-size: 24rpx;
				font-weight: 400;
				color: #606266;
				margin-top: 10rpx;
			}
		}

		>view:nth-of-type(3) {
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			>view:nth-of-type(1) {
				width: 160rpx;
				height: 64rpx;
				border-radius: 44rpx;
				border: 1rpx solid #1487FA;
				text-align: center;
				line-height: 64rpx;
			}

			>view:nth-of-type(2) {
				font-size: 20rpx;
				color: #909399;
				margin-top: 8rpx;
			}
		}
	}

	.giftsList {
		width: 90%;
		height: 180rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-around;
		align-items: center;
		box-sizing: border-box;
		white-space: nowrap;
		position: relative;
	}

	.qdGift {
		position: relative;
		width: 130rpx;
		height: 180rpx;
		display: inline-block;
		margin-left: 20rpx;
		text-align: center;

		>view:nth-of-type(1) {
			width: 90rpx;
			height: 90rpx;
			background-size: 100% 100%;
			background-repeat: no-repeat;
			background-position: center;
			margin-top: 20rpx;
			margin-left: 20rpx;
		}

		>view:nth-of-type(2) {
			font-size: 26rpx;
			color: #606266;
			margin-top: 10rpx;
		}

		.tips {
			position: absolute;
			top: 0rpx;
			right: -49rpx;
			z-index: 2;
			width: 108rpx;
			height: 40rpx;
			background: #F7A14A;
			box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(250, 152, 48, 0.302);
			border-radius: 24rpx 24rpx 24rpx 0rpx;
			font-size: 20rpx;
			color: #FFFFFF;
			text-align: center;
			line-height: 40rpx;
		}
	}

	.arrowClick {
		width: 80rpx;
		// height: 60rpx;
		padding: 20rpx 10rpx;
		box-sizing: border-box;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
	}
</style>